//
//  RequestMessageData.m
//  CarStop
//
//  Created by lanou3g on 15/7/16.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "RequestMessageData.h"

@implementation RequestMessageData

- (void)requestMessageUrl:(NSString *)mesUrl reqSuccessBlockM:(reqMesSuccessBlock)reqSuccessBlockM reqErrorBlockM:(reqMesErrorBlock)reqErrorBlockM{

    self.reqSuccessBlockM = reqSuccessBlockM;
    self.reqErrorBlockM = reqErrorBlockM;
    
    NSURL *url = [NSURL URLWithString:mesUrl];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
    if (data) {
        self.reqSuccessBlockM(data);
    }
    if (data == nil) {
        self.reqErrorBlockM(nil);
    }
    
}

@end
